package com.focusai.efairy.utils;

import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;

import com.focusai.efairy.EFApplication;

import java.io.File;

/**
 * Created by luo_guangwen on 2017/8/19.
 */

public class UriUtil {
    public static Uri fromFile(File file){
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
            String authority = "com.focusai.efairy.provider.fileprovider";
            if (EFApplication.isCciotApp()){
                authority = "com.focusai.cciot.provider.fileprovider";
            }
            return FileProvider.getUriForFile(EFApplication.getContext(), authority, file);
        }else {
            return android.net.Uri.fromFile(file);
        }
    }
}
